﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace Aliyeye.Car.Net.UI.Common
{
    public class PageCommon
    {
        #region 对话框，Alert,Confirm

        public static void Alert(string message)
        {
            PopupDialog.DialogWarning dialog = new PopupDialog.DialogWarning(message);
            dialog.ShowDialog();
        }

        public static void Alert(string message, Form from)
        {
            PopupDialog.DialogWarning dialog = new PopupDialog.DialogWarning(message);
            dialog.ShowDialog(from);
        }

        public static void Error(string message)
        {
            PopupDialog.DialogError dialog = new PopupDialog.DialogError(message);
            dialog.ShowDialog();
        }

        public static void Error(string message, IWin32Window owner)
        {
            PopupDialog.DialogError dialog = new PopupDialog.DialogError(message);
            dialog.ShowDialog(owner);
        }

        public static bool Confirm(string message)
        {
            PopupDialog.DialogConfirm dialog = new PopupDialog.DialogConfirm(message);
            return (dialog.ShowDialog() == DialogResult.OK);
        }

        public static void Notify(string message)
        {
            PopupDialog.DialogNotify dialog = new PopupDialog.DialogNotify(message);
            dialog.ShowDialog();
            //dialog.ShowDialog(MainWin.GetInstance());

        }

        #endregion

        /// <summary>
        /// 打开帮助文档
        /// </summary>
        public static void ShowHelp()
        {
            IntPtr helperHandle = win32.FindWindow(null, "远程部署系统帮助");
            if (helperHandle.Equals(IntPtr.Zero))
            {
                System.Diagnostics.Process.Start(System.Environment.CurrentDirectory + "\\help.chm");
            }
            else
            {
                win32.SetActiveWindow(helperHandle);
                win32.SetForegroundWindow(helperHandle);
                win32.ShowWindow(helperHandle, 10);
            }
        }

    }
}
